<template>
    <div class="">
      <el-dialog  v-model="dialogVisible" :title="porps.inner.title" class="body"   :before-close="handleClose">
        <div class="time">{{ "发布时间："+moment(porps.inner.addtime).format("YYYY-MM-DD hh:mm:ss")  }}</div>
        <div class="content" v-html="content" ></div>
      </el-dialog>
    </div>
  </template>
  
  <script lang='ts' setup>
  import { ref,defineProps, onMounted } from "vue"
  import moment  from "moment";
  import { newsonelist } from "../service/news/news"
  const porps = defineProps({
      inner: {
          type: Object,
          default: () => ({})
      },
  })
  
  const content = ref("")
  const getnewsonelist = ()=>{
    newsonelist(porps.inner.id).then(res=>{
      console.log(res.data.content)
      content.value = res.data.content.replace(/<img/g,"<img style='max-width:100%'")
    })
  } 
  const dialogVisible = ref(true)
  
  const emit = defineEmits(['close'])
  const handleClose = () => {
    dialogVisible.value = false
    emit('close',[])
  }
  

  onMounted(()=>{
    getnewsonelist()
  })
  </script>
  
  <style  scoped>
 
  /deep/.body{
  width: 100vh;
  height: 839px;
  display: flex;
  flex-direction: column;
  align-items: center;
   
}
.time{
      width: 80vh;
      text-align: center;
      margin-top: 50px;
      padding-bottom: 10px;
      border-bottom: 1px solid #ccc;
    }

  </style>
  